package orchestration.businessprocess.model.nodes;

import java.util.HashSet;

import orchestration.businessprocess.model.BPNodeId;
import orchestration.businessprocess.model.IBPVisitor;



/**
 * A join gateway has a set of predecessors and one successor
 * All predecessor should be visited before visiting the successor
 * @author  <a href="mailto:car.ferrarini@gmail.com">Carlo Ferrarini</a>
 */
public class BPJoinGateway extends BPNode {

	/**
	 * @uml.property  name="prev"
	 */
	private HashSet<BPNode> prev;
	/**
	 * @uml.property  name="next"
	 * @uml.associationEnd  
	 */
	private BPNode next;
	
	BPJoinGateway(BPNodeId id, HashSet<BPNode> prev,BPNode next) {
		super(id,BPNode.NODE_TYPE_JGW,null,null);
		this.prev=prev;
		this.next=next;
	}

	public BPJoinGateway(BPNodeId id) {
		super(id,BPNode.NODE_TYPE_JGW,null,null);
		this.prev= new HashSet<BPNode>();
	}

	@Override
	public void accept(IBPVisitor visitor) {
		visitor.visit(this);
	}
	/**
	 * @return
	 * @uml.property  name="prev"
	 */
	public HashSet<BPNode> getPrev(){
		return this.prev;
	}

	/**
	 * @return
	 * @uml.property  name="next"
	 */
	public BPNode getNext() {
		return this.next;
	}
	/**
	 * @param next
	 * @uml.property  name="next"
	 */
	public void setNext(BPNode next) {
		this.next = next;
	}
	public void addPrev(BPNode prev){
		this.prev.add(prev);
	}

}
